package P3775;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

/**
 * Problema da disciplina de Estrutura de Dados e Complexidade de Algoritmos da
 * Pos Graduacao do Periodo 2011.1
 *
 * @see http://br.spoj.pl/problems/FLIPERAM/
 * @author Elenilson Vieira - 111100371 - elenilson[at]elenilsonvieira.com
 * @since 23 de abril de 2011
 */
public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String data[] = reader.readLine().trim().split(" ");
        int matchesPlayed = Integer.parseInt(data[0]);
        int maxDisplay = Integer.parseInt(data[1]);

        int games[] = new int[matchesPlayed];

        for(int i = 0; i < matchesPlayed; i++)
            games[i] = Integer.parseInt(reader.readLine());

        Arrays.sort(games);

        for(int i = games.length - 1; i >= games.length - maxDisplay; i--)
            System.out.println(games[i]);
    }

}
